Form prompt_2 = new Form();
prompt_2.Width = width;
prompt_2.Height = height;
prompt_2.Text = "";
prompt_2.AutoScroll = true;
string myConnection = "datasource=localhost;port=3306;username=root;password=''";
// conncet by varaible
MySqlConnection myConn = new MySqlConnection(myConnection);
// assign varaible to reading from data base
MySqlDataReader mdr;
string selectQuery1 = "";
string insertQuery4 = "";
MySqlCommand SelectCommand = new MySqlCommand(selectQuery1, myConn);
MySqlCommand command = new MySqlCommand(insertQuery4, myConn);
int total_columns = 0;
int ii = 0;
List columns_list = new List();
myConn.Open();
try {
selectQuery1 = "SELECT COUNT(*) AS total_columns FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = 'methods' AND table_name = 'all_methods'; ";
SelectCommand = new MySqlCommand(selectQuery1, myConn);
mdr = SelectCommand.ExecuteReader();
if (mdr.Read())
{
total_columns = Int32.Parse(mdr.GetString("total_columns"));
}
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
finally {
myConn.Close();
}
for (ii = 0; ii < total_columns; ii++)
{
myConn.Open();
try
{
selectQuery1 = "SELECT COLUMN_NAME FROM information_schema.columns WHERE TABLE_SCHEMA = 'tasks' AND TABLE_NAME = 'all_tasks' AND ORDINAL_POSITION = "+ii;
SelectCommand = new MySqlCommand(selectQuery1, myConn);
mdr = SelectCommand.ExecuteReader();
if (mdr.Read())
{
columns_list.Add(mdr.GetString("COLUMN_NAME"));
}
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
finally
{
myConn.Close();
}
}
for (ii = 0; ii < columns_list.Count; ii++){
if (columns_list[ii] != "id")
{
myConn.Open();
try
{
insertQuery4 = "UPDATE tasks.all_tasks SET " + columns_list[ii] + " = default where id= 85";
command = new MySqlCommand(insertQuery4, myConn);
if (command.ExecuteNonQuery() == 1)
{
}
else
{
MessageBox.Show("Data Not Inserted");
}
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
finally
{
// close connection
myConn.Close();
}
}
}
Form prompt = new Form();
prompt.Width = 500;
prompt.Height = 50;
List controllers = new List();
for (int i = 0; i < 5; i++)
{
controllers.Add(new TextBox());
controllers[i].Location = new Point(i*100, 0);
controllers[i].Size = new System.Drawing.Size(100, 50);
prompt.Controls.Add(controllers[i]);
}
prompt.ShowDialog();
int jj = 0;
int ii = 0;
int xx = 0;
string read_query = "";
string selectQuery1 = "";
string insertQuery4 = "";
string myConnection = "datasource=localhost;port=3306;username=root;password=''";
MySqlConnection myConn = new MySqlConnection(myConnection);
MySqlDataReader mdr;
MySqlCommand SelectCommand = new MySqlCommand(selectQuery1, myConn);
MySqlCommand command = new MySqlCommand(selectQuery1, myConn);
int max_rating = 1200;
int instances = 0;
List buttons_list = new List();
List pushed_buttons_titles_list = new List();
prompt.StartPosition = FormStartPosition.Manual;
prompt.Location = new Point(0, 0);
prompt.ShowDialog();
}
int kk = 0;
for (jj= pushed_buttons_titles_list.Count;jj>0; jj--) {
insertQuery4 = "update tasks.goals set rating_1 = " + (xx + jj) + " where title = '" + pushed_buttons_titles_list[kk] +"';";
myConn.Open();
try
{
command = new MySqlCommand(insertQuery4, myConn); if (command.ExecuteNonQuery() == 1)
{
}
else
{
}
}
catch (Exception ex)
{
}
finally { myConn.Close(); }
kk = kk + 1;
}
// if still more than 1 instacne repeat
instances = 0;
myConn.Open();
try
{
read_query = "SELECT COUNT(*) FROM tasks.goals where rating_1 = " + xx;
SelectCommand = new MySqlCommand(read_query, myConn);
mdr = SelectCommand.ExecuteReader();
if (mdr.Read())
{
instances = Int32.Parse(mdr.GetString("COUNT(*)"));
}
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
finally
{
myConn.Close();
}
if (instances > 1) { xx = xx - 1; }
}
// class document
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
namespace WindowsFormsApp7
{
class load_window_1_functions_2
{
string cs = @"URI=file:" + System.Windows.Forms.Application.StartupPath + "\\..\\..\\databases\\" + drop_down_value_2 + ".db";
var con = new SQLiteConnection(cs);
con.Open();
SQLiteDataAdapter sqlda = new SQLiteDataAdapter("SELECT * FROM " + drop_down_value + " order by id asc", con);
System.Data.DataTable data_table_1 = new System.Data.DataTable();
sqlda.Fill(data_table_1);
grid_1.DataSource = data_table_1;
con.Close();
public static class Globals
{
public static int right_mouse_clicks_in_a_row = 0;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using MySql.Data.MySqlClient;
using System.Text.RegularExpressions;
namespace WindowsFormsApp7
{
class even_better_image_selection
{
public static class Globals
{
public static int file_index = 1;
public static string PictureBox_1_path = "C:/Users/mr big/Dropbox/code/c sharp/none snippets/style/images/categories/concepts/black.png";
public static string PictureBox_2_path = "C:/Users/mr big/Dropbox/code/c sharp/none snippets/style/images/categories/concepts/black.png";
public static List[,] populate_dropdowns()
{
string read_query = "";
string selectQuery1 = "";
int next_array_index = 0;
string myConnection = "datasource=localhost;port=3306;username=root;password=''";
MySqlConnection myConn = new MySqlConnection(myConnection);
MySqlDataReader mdr;
MySqlCommand SelectCommand = new MySqlCommand(selectQuery1, myConn);
MySqlCommand command = new MySqlCommand(selectQuery1, myConn);
List tables_list = new List();
List[,] returned_array = new List[500, 500];
List array_length = new List();
int total_tables = 0;
int ii = 0;
// open connection
myConn.Open();
try
{
// command string
selectQuery1 = "SELECT count(*) AS total_tables FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'counts_3';";
// execute commadnt to select quary
SelectCommand = new MySqlCommand(selectQuery1, myConn);
// assign varaible to reader of fethcing quary
mdr = SelectCommand.ExecuteReader();
// assign value feteched to text box
if (mdr.Read())
{
total_tables= Int32.Parse(mdr.GetString("total_tables"));
}
}
catch { }
finally
{
// close connection
myConn.Close();
}
for (ii = 0; ii < total_tables; ii++) {
myConn.Open();
try
{
// command string
selectQuery1 = "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'counts_3' limit "+ii+",1;";
// execute commadnt to select quary
SelectCommand = new MySqlCommand(selectQuery1, myConn);
// assign varaible to reader of fethcing quary
mdr = SelectCommand.ExecuteReader();
// assign value feteched to text box
if (mdr.Read())
{
tables_list.Add(mdr.GetString("TABLE_NAME"));
}
}
catch { }
finally
{
// close connection
myConn.Close();
}
}
List tables_list_title = new List();
tables_list_title.Add("tables_list_title");
returned_array[next_array_index, 0] = tables_list_title;
returned_array[next_array_index, 1] = tables_list;
array_length.Add("1");
next_array_index = next_array_index + 1;
List array_length_title = new List();
array_length_title.Add("array_length_title");
returned_array[next_array_index, 0] = array_length_title;
returned_array[next_array_index, 1] = array_length;
return returned_array;
}
// form
try
{
if (populate_dropdowns_switch == "v")
{
List[,] returned_array_2 = new List[10, 10];
returned_array_2 = in_day_function_populate_dropdowns.populate_dropdowns();
int array_length = 0;
for (ii = 0; ii < Math.Sqrt(returned_array_2.Length); ii++)
{
if (returned_array_2[ii, 0][0] == "array_length_title")
{
array_length = returned_array_2[ii, 1].Count;
ii = Convert.ToInt32(Math.Sqrt(returned_array_2.Length));
}
}
for (ii = 0; ii < array_length; ii++)
{
if (returned_array_2[ii, 0][0] == "tables_list_title")
{
var host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
MessageBox.Show(ip.ToString());
}
}
string[] array_0 = Directory.GetFiles(@"C:Usersmr bigDropboxcodec sharp
one snippetsstyleimagesmedalsall");
List numbers_in_files_names_list = new List();
for (jj = 0; jj < array_0.Length; jj++)
{
if(array_0[jj].Contains("unique__")){
MessageBox.Show(array_0[jj]);
numbers_in_files_names_list.Add(Int32.Parse(Regex.Match(array_0[jj], @"d+").Value));
}
}
if (n
String address = "";
WebRequest request = WebRequest.Create("http://checkip.dyndns.org/");
using (WebResponse response = request.GetResponse())
using (StreamReader stream = new StreamReader(response.GetResponseStream()))
{
address = stream.ReadToEnd();
}
int first = address.IndexOf("Address: ") + 9;
int last = address.LastIndexOf("
");
address = address.Substring(first, last - first);
MessageBox.Show(address);
var today = DateTime.Today;
var yesterday = today.AddDays(-1);
string yesterday_2 = yesterday.ToString("M/d/yyyy");
MessageBox.Show(yesterday_2);
public static int get_instance_of_day_of_the_week_in_month_of_date_function(string check_for_date)
{
command = new MySqlCommand(insertQuery, myConn);
// needed for soemr eason
if (command.ExecuteNonQuery() == 1)
{
MessageBox.Show("Data Inserted");
}
else
{
MessageBox.Show("Data Not Inserted");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
myConn.Close();
}
};
prompt.Show();
string cs = @"URI=file:e:database4.db";
var con = new SQLiteConnection(cs);
con.Open();
var cmd = new SQLiteCommand(con);
cmd.CommandText = "INSERT INTO test_2(column_1) VALUES(@number)";
cmd.Parameters.AddWithValue("@number", 9090);
cmd.Prepare();
cmd.ExecuteNonQuery();
public static void insert_to_all_tables_in_database_function(string datebase, string columns, string values)
{
if (Int32.Parse(seconds_passed_in_form.Text) % 3600 == 0)
{
backup_sqlite.backup_sqlite_function();
}
class backup_sqlite
{
public static string backup_sqlite_function()
{
// get total folders
int directoryCount = System.IO.Directory.GetDirectories(@"C:\Users\mr big\Dropbox\code\mysql\none snippets\backups\sqlite_backups").Length;
//Now Create all of the directories
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
{
Directory.CreateDirectory(dirPath.Replace(sourcePath, targetPath));
}
//Copy all the files & Replaces any files with the same name
foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories))
{
File.Copy(newPath, newPath.Replace(sourcePath, targetPath), true);
}
public static class Globals
{
public static string player_state = "";
public static int media_files_played = 0;
public static int folder_played = 0;
public static string path = "";
public static string folder = "";
}
if (add_columns_machine_box.Text == "phpmyadmin")
{
myConnection = "datasource=localhost;port=3306;username=root;password=''";
}
if (add_columns_machine_box.Text == "pc")
{
myConnection = "datasource=localhost;port=3360;username=root;password='12345'";
}
if (add_columns_machine_box.Text == "personal_website")
{
myConnection = "server=50.87.144.149; database=nadavroc_personal_website; Uid=nadavrock; pwd=PZo#mpIccDms;";
}
MySqlConnection myConn = new MySqlConnection(myConnection);
MySqlCommand SelectCommand = new MySqlCommand(sql, myConn);
// assign varaible to reading from data base
string insertQuery4 = "";
int total_columns = 0;
string last_column = "";
string previous_column="";
string column_type = "";
string column_length = "11";
string column_default = "0";
MySqlCommand command = new MySqlCommand(insertQuery4, myConn);
// assign varaible to reading from data base
MySqlDataReader mdr;
// store all tables of data base in list
// ./.
// open connection
myConn.Open();
List tables_list_2 = new List();
// command string
selectQuery1 = "show tables from " + add_column_database_box.Text;
// execute commadnt to select quary
SelectCommand = new MySqlCommand(selectQuery1, myConn);
// assign varaible to reader of fethcing quary
mdr = SelectCommand.ExecuteReader();
// assign value feteched to text box
while (mdr.Read())
{ tables_list_2.Add(mdr.GetString("Tables_in_" + add_column_database_box.Text)); }
// close connection
myConn.Close();
// /./
for (int ii = 0; ii < tables_list_2.Count; ii++)
{
// get column type and length and dfault
// ./.
myConn.Open();
// command string
selectQuery1 = "SELECT data_type from information_schema.columns where table_schema = '" + add_column_database_box.Text + "' and table_name = '" + tables_list_2[ii] + "' AND COLUMN_NAME = '" + add_columns_column_1_name_box.Text + "'";
// execute commadnt to select quary
SelectCommand = new MySqlCommand(selectQuery1, myConn);
// assign varaible to reader of fethcing quary
mdr = SelectCommand.ExecuteReader();
// assign value feteched to text box
if (mdr.Read())
{
column_type = mdr.GetString("data_type");
}
// close connection
myConn.Close();
// get column default
// ./.
myConn.Open();
try
{
// command string
selectQuery1 = "SELECT Column_Default from information_schema.columns where table_schema = '" + add_column_database_box.Text + "' and table_name = '" + tables_list_2[ii] + "' AND COLUMN_NAME = '" + add_columns_column_1_name_box.Text + "'";
// execute commadnt to select quary
SelectCommand = new MySqlCommand(selectQuery1, myConn);
// assign varaible to reader of fethcing quary
mdr = SelectCommand.ExecuteReader();
// assign value feteched to text box
if (mdr.Read())
{
// get total columns in table
// ./.
// open connection
myConn.Open();
// command string
selectQuery1 = "SELECT COUNT(*) AS total_columns FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = '" + add_column_database_box.Text + "' AND table_name = '" + tables_list_2[ii] + "'; ";
// execute commadnt to select quary
SelectCommand = new MySqlCommand(selectQuery1, myConn);
// assign varaible to reader of fethcing quary
mdr = SelectCommand.ExecuteReader();
// assign value feteched to text box
if (mdr.Read())
{
total_columns = Int32.Parse(mdr.GetString("total_columns"));
}
// close connection
myConn.Close();
// /./
// if index greater than total columnsget last column name
// ./.
if (Int32.Parse(move_column_to_index_box.Text) > (total_columns + 1))
{
// get last column
myConn.Open();
selectQuery1 = " SELECT COLUMN_NAME FROM information_schema.columns WHERE TABLE_SCHEMA = '" + add_column_database_box.Text + "' AND TABLE_NAME = '" + tables_list_2[ii] + "' AND ORDINAL_POSITION = " + total_columns;
SelectCommand = new MySqlCommand(selectQuery1, myConn);
mdr = SelectCommand.ExecuteReader();
if (mdr.Read())
{
last_column = (mdr.GetString("COLUMN_NAME"));
}
myConn.Close();
string myConnection = "datasource=localhost;port=3306;username=root;password=''";
MySqlConnection myConn = new MySqlConnection(myConnection);
MySqlDataReader mdr;
string selectQuery1 = "";
MySqlCommand SelectCommand = new MySqlCommand(selectQuery1, myConn);
int total_columns = 0;
int ii = 0;
List columns_list = new List();
List columns_defaults_list = new List();
myConn.Open();
try
{
selectQuery1 = "SELECT COUNT(*) AS total_columns FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = '"+ database+"' AND table_name = '"+ table_name+"'; ";
SelectCommand = new MySqlCommand(selectQuery1, myConn);
mdr = SelectCommand.ExecuteReader();
if (mdr.Read())
{
total_columns = Int32.Parse(mdr.GetString("total_columns"));
}
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
finally
{
myConn.Close();
}
for (ii = 2; ii < total_columns+1; ii++)
{
myConn.Open();
try
{
selectQuery1 = "SELECT COLUMN_NAME FROM information_schema.columns WHERE TABLE_SCHEMA = '"+database+"' AND TABLE_NAME = '"+table_name+"' AND ORDINAL_POSITION = " + ii;
SelectCommand = new MySqlCommand(selectQuery1, myConn);
mdr = SelectCommand.ExecuteReader();
if (mdr.Read())
{
columns_list.Add(mdr.GetString("COLUMN_NAME"));
}
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
finally
{
myConn.Close();
}
}
// /./
// get all default
// ./.
for (ii = 0; ii < columns_list.Count; ii++)
{
myConn.Open();
try
{
selectQuery1 = "SELECT Column_Default FROM Information_Schema.Columns WHERE Table_Schema = '"+database+"' AND Table_Name = '"+table_name+"' AND Column_Name = '"+columns_list[ii]+"'";
SelectCommand = new MySqlCommand(selectQuery1, myConn);
mdr = SelectCommand.ExecuteReader();
if (mdr.Read())
{
columns_defaults_list.Add(mdr.GetString("Column_Default"));
}
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
finally
{
myConn.Close();
}
}
// /./
public static int on_screen_keyboard_function(int original_form_width)
{
string selectQuery1 = "";
int ii = 0;
int jj = 0;
string sql = " SELECT * FROM counts ";
string myConnection = "datasource=localhost;port=3306;username=root;password='';Charset=utf8";
MySqlConnection myConn = new MySqlConnection(myConnection);
MySqlCommand SelectCommand = new MySqlCommand(sql, myConn);
// assign varaible to reading from data base
MySqlDataReader mdr;
string insertQuery4 = "";
MySqlCommand command = new MySqlCommand(insertQuery4, myConn);
List buttons_list = new List();
List buttons_text_list = new List();
int max_row = 6;
int max_column = 5;
Form prompt = new Form();
prompt.Width = max_column * 50 + 15;
prompt.Height = max_row * 50 + 40;
prompt.Text = "";
prompt.BackgroundImage = Properties.Resources.texture_5;
prompt.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
prompt.AutoScroll = false;
prompt.HorizontalScroll.Enabled = false;
prompt.HorizontalScroll.Visible = false;
prompt.HorizontalScroll.Maximum = 0;
prompt.AutoScroll = true;
char ch = 'a';
for (ii = 0; ii < max_row; ii++)
{
for (jj = 0; jj < max_column; jj++)
{
buttons_list.Add(new Button());
buttons_list[jj + ii * max_column].FlatStyle = FlatStyle.Flat;
buttons_list[jj + ii * max_column].Location = new Point(jj * 50, (ii) * 50);
buttons_list[jj + ii * max_column].Size = new System.Drawing.Size(50, 50);
buttons_list[jj + ii * max_column].Text = ch.ToString();
if (jj + ii * max_column == 29) {
buttons_list[jj + ii * max_column].Text = "clear";
}
ch++;
prompt.Controls.Add(buttons_list[jj + ii * max_column]);
int button_index = jj + ii * max_column;
buttons_list[jj + ii * max_column].Click += (sender, e) =>
{
FormCollection fc = Application.OpenForms;
foreach (Form frm in fc)
{
if (frm.Name == "home")
{
foreach (Control c in frm.Controls)
{
if (c.Name == "search_box")
{
if (button_index != 29)
{
c.Text = c.Text + buttons_list[button_index].Text;
}
else {
c.Text = "";
}
}
}
}
}
};
}
}
int screen_width = Screen.PrimaryScreen.Bounds.Width; ;
prompt.StartPosition = FormStartPosition.Manual;
prompt.Location = new Point(screen_width - original_form_width- prompt.Width, 0);
prompt.Show();
return 0;
}
string formtocall = "frequent_windows_window";
var form = Activator.CreateInstance(Type.GetType("WindowsFormsApp7." + formtocall)) as Form;
form.Show();
var process = new Process();
process.StartInfo.FileName = @"C:Program Files (x86)\Google\Chrome\Application\chrome.exe";
process.StartInfo.Arguments = "https://www.google.com/"
process.Start();
string formtocall = "test_form";
var form = Activator.CreateInstance(Type.GetType("WindowsFormsApp7." + formtocall)) as Form;
form.Show();
public static void prompt_multi_medals_and_texts_function(int width, int height, string method_1, string method_2, string text, Color text_color_1, Color text_color_2, Color text_color_3, Color text_color_4, string mode)
{
int level_1 = 0;
int level_2 = 0;
string picture_1 = "xxx";
string picture_2 = "xxx";
string sound = "xxx";
new System.Threading.Thread(() => {
var c = new System.Windows.Media.MediaPlayer();
c.Open(new System.Uri(@"C:\Users\mr big\Dropbox\code\c sharp\none snippets\sounds\bells_1.wav"));
c.Play();
}).Start();
System.Threading.Thread.Sleep(500);
new System.Threading.Thread(() => {
var c = new System.Windows.Media.MediaPlayer();
c.Open(new System.Uri(@"C:\Users\mr big\Dropbox\code\c sharp\none snippets\sounds\idea_1.wav"));
c.Play();
}).Start();
this.Location = new Point(0, 0);
class form_position
{
public static string form_position_function(string mode,Form form_to_position,Form form_to_position_in_relation_to,string position)
{
if (mode == "relative") {
if (position == "top_right")
{
form_to_position.StartPosition = FormStartPosition.Manual;
form_to_position.Location = new Point(form_to_position_in_relation_to.Left + form_to_position_in_relation_to.Width-15,form_to_position_in_relation_to.Top);
}
myConn.Open();
try
{
read_query = "SELECT id FROM tasks.goals where rating_1 = " + ii +" limit 0,1";
SelectCommand = new MySqlCommand(read_query, myConn);
mdr = SelectCommand.ExecuteReader();
if (mdr.Read())
{
id = Int32.Parse(mdr.GetString("id"));
}
}
catch (Exception ex) {
//MessageBox.Show(ex.Message);
}
finally
{
myConn.Close();
}
insertQuery4 = "update tasks.goals set rating_1 = " + (ii + jj) + " where id = " + id;
myConn.Open();
try
{
command = new MySqlCommand(insertQuery4, myConn); if (command.ExecuteNonQuery() == 1)
{
}
else {
// MessageBox.Show("Data Not Inserted");
}
}
catch (Exception ex) {
//MessageBox.Show(ex.Message);
}
finally { myConn.Close(); }
}
}
Rectangle bounds_2 = Screen.PrimaryScreen.Bounds;
using (Bitmap bitmap = new Bitmap(bounds_2.Width, bounds_2.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(new Point(bounds_2.Left, bounds_2.Top), Point.Empty, bounds_2.Size);
}
bitmap.Save(save_path);
}
string[] array1 = Directory.GetFiles(@"C:
ock
ot in dropboxfiles manipulation work folderscopying1");
// outer loop go thorugh to filter
i = 0;
for (i = 0 ; i < array1.Length;i++)
{
Bitmap image1 = new Bitmap(array1[i], true);
if (image1.Width > 2000 || image1.Height > 2000)
{
System.IO.File.Copy(array1[i], @"C:
ock
ot in dropboxfiles manipulation work folderscopying oo big" + Path.GetFileNameWithoutExtension(array1[i])+ ".png");
}
else
{
System.IO.File.Copy(array1[i], @"C:
ock
ot in dropboxfiles manipulation work folderscopyingoutput 1unique__" + maxValue + ".png");
maxValue = maxValue + 1;
}
}
string cs = @"URI=file:"+Application.StartupPath+ "\..\..databases\database1\database4.db";
var con = new SQLiteConnection(cs);
con.Open();
var cmd = new SQLiteCommand(con);
cmd.CommandText = "INSERT INTO test_2(column_1) VALUES(898989898)";
cmd.Prepare();
cmd.ExecuteNonQuery();
string user_friendly_polymath_connection_string = @"URI=file:" + System.Windows.Forms.Application.StartupPath + "\\..\\..\\databases\\user_friendly_polymath.db";
var user_friendly_polymath_connection = new SQLiteConnection(user_friendly_polymath_connection_string);
SQLiteDataReader sqlite_datareader;
SQLiteCommand sqlite_cmd;
List columns_list = new List();
int ii = 0;
user_friendly_polymath_connection.Open();
try
{
sqlite_cmd = user_friendly_polymath_connection.CreateCommand();
sqlite_cmd.CommandText = "select * from users_home_buttons";
using (var reader = sqlite_cmd.ExecuteReader())
{
if (reader.Read())
{
for ( ii = 0; ii < reader.FieldCount; ii++)
{
columns_list.Add(reader.GetName(ii));
}
string cs = @"URI=file:" + System.Windows.Forms.Application.StartupPath + "\..\..\databases\"+ drop_down_value+".db";
var con = new SQLiteConnection(cs);
con.Open();
SQLiteDataReader sqlite_datareader;
SQLiteCommand sqlite_cmd;
sqlite_cmd = con.CreateCommand();
sqlite_cmd.CommandText = "SELECT name FROM sqlite_master WHERE type ='table' AND name NOT LIKE 'sqlite_%'";
using (var reader = sqlite_cmd.ExecuteReader())
{
while (reader.Read())
{
//MessageBox.Show(reader.GetString(0));
tables_dropdown.Items.Add(new KeyValuePair(reader.GetString(0), "0"));
// in namesapce
System.Timers.Timer t;
int h, m, s, s_2;
// on form load
t = new System.Timers.Timer();
t.Interval = 1000; // 1s
t.Elapsed += OnTimeEvent;
t.Start();
// on time event
private void OnTimeEvent(object sender, System.Timers.ElapsedEventArgs e)
{
Invoke(new Action(() =>
{
s += 1;
s_2 += 1;
if (s == 60)
{
// s = 0;
// m += 1;
}
if (m == 60)
{
// m = 0;
// h += 1;
}
if (timer_status_box_1.Text == "start")
{
timer_1_seconds_when_paused.Text = s_2.ToString();
int timer_1_total_seconds_passed = s - Int32.Parse(timer_1_s_at_start_box.Text);
int timer_1_minutes_passed = 0;
if (s_2 == 60)
{
timer_1_minutes_passed = timer_1_total_seconds_passed / 60;
timer_1_minutes_when_paused.Text = (timer_1_total_seconds_passed / 60).ToString();
s_2 = 0;
timer_1_seconds_when_paused.Text = "0";
}
List months_list = new List();
// get total rows
int sum_in_month = 0;
myConn.Open();
// command strings
read_query = "SELECT COUNT(*) FROM counts_4.sleep_minutes_in_day;";
// execute commadnt to select quary
SelectCommand = new MySqlCommand(read_query, myConn);
// assign varaible to reader of fethcing quary
mdr = SelectCommand.ExecuteReader();
// assign value feteched to text box
if (mdr.Read())
{
total_rows = Int32.Parse(mdr.GetString("COUNT(*)"));
}
// close connection
myConn.Close();
// list of uniques date
months_list.Clear();
for (ii = 1; ii <= total_rows; ii++) {
myConn.Open();
// command strings
read_query = "SELECT date FROM counts_4.sleep_minutes_in_day where id ="+ ii;
// execute commadnt to select quary
SelectCommand = new MySqlCommand(read_query, myConn);
// assign varaible to reader of fethcing quary
mdr = SelectCommand.ExecuteReader();
// assign value feteched to text box
if (mdr.Read())
{
try
{
DateTime date_time_1 = Convert.ToDateTime(mdr.GetString("date"));
int month = date_time_1.Month;
int year = date_time_1.Year;